xen/arm: vcpu: Correctly release resources when a VCPU fails to initialize
authorJulien Grall <julien.grall@linaro.org>
Wed, 30 Apr 2014 19:15:55 +0000 (20:15 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Mon, 2 Jun 2014 13:38:12 +0000 (14:38 +0100)
commit911232f02a637f65726d9f7cf7f480f34786b8e1
treefc594fd205f5be9d5574b64d55ec42d283f91323
parentb2a332bfde7aff580f461a1d81b5340573d556d1
xen/arm: vcpu: Correctly release resources when a VCPU fails to initialize

While I was adding new failing code at the end of the function, I noticed
that the vtimers are not freed which messes up all the timers and will crash
Xen quickly when the page s reused.

Currently neither vcpu_vgic_init nor vcpu_vtimer_init fails, so we
are safe for now. With the new GICv3 code, the former function will be able
to fail. This will result in a memory leak.

Call vcpu_destroy if the initialization has failed. We also need to add a
boolean to know if the vtimers are correctly setup as the timer common code
doesn't have any safeguard against removing a non-initialized timer.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
xen/arch/arm/domain.c
xen/arch/arm/vtimer.c
xen/include/asm-arm/domain.h